/**
 * Created by John on 2016/7/12.
 */
var results = myCollection.aggregate("...");
results.result.forEach(function (item) {
    //...
});

results = myCollection.aggregate("...");
results.forEach(function (item) {
    //...
});

aggregate(
    {$match: {type: 'x'}},
    {$group: {set_id: '$o_id', total: {$sum: "$value"}}},
    function (err, results) {
    }
);

results = myCollection.mapReduce(
    function () {
        emit(this.key, this.value);
    },
    function (key, values) {
        return Array.sum(values);
    },
    {
        out: {inline: 1},
        query: {value: {$gt: 6}}
    }
);